package lec14dfs;

import java.util.Arrays;

public class DfsSubSet {
    static int n = 5;
    static int[] a = new int[]{1, 2, 3, 4, 5};
    static int[] book = new int[n];

    static void dfs(int k) {
        if (k == n) {
            int s = 0;
            for (int j = 0; j < n; j++) {
                if (book[j] == 1)
                    s += a[j];
            }
            if (s == 10) {
                System.err.println(Arrays.toString(book));
            }
            //System.out.println(Arrays.toString(book));
            return;
        }
        book[k] = 0;
        dfs(k + 1);
        book[k] = 1;
        dfs(k + 1);

    }


    public static void main(String[] args) {
        dfs(0);

    }


}
